<!doctype html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <div th:replace="common/backstageNavigator.html :: head"></div>

</head>

<body>
<div th:replace="common/backstageNavigator.html :: banner"></div>

<div class="container-fluid" id="TA">
    <div class="row">
        <div th:replace="common/backstageNavigator.html :: navi"></div>
        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
            <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pb-2 mb-3 border-bottom">
                <h1 class="h2">修改密码</h1>
            </div>
            <script src="js/selectcourse/vue-resource.min.js"></script>
            <form id="datatable">
                <div class="form-group col-sm-4">
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text">用户账号</span>
                        </div>
                        <input class="form-control mr-sm-2" type="text" v-model="account"
                               placeholder="" required="required">
                    </div>
                </div>
                <div class="form-group col-sm-4">
                    <div class="input-group">
                        <div class="input-group-prepend">
                            <span class="input-group-text">新的密码</span>
                        </div>
                        <input class="form-control mr-sm-2" type="text" v-model="newpass"
                               placeholder="" required="required">
                    </div>
                </div>

                <div class="form-group col-sm-4">
                    <!--<button class="btn btn-outline-primary mr-sm-2" @click="chagePass()">-->
                        <!--<span data-feather="user-plus" ></span>-->
                        <!--修改密码-->
                    <!--</button>-->
                    <input type="button" class="btn btn-outline-primary mr-sm-2" @click="changePass()" value="修改密码">
                </div>
            </form>

            <script type="text/javascript">
                var vm = new Vue({
                    el:"#datatable",
                    data:{
                        account:"",
                        newpass:""
                    },
                    methods: {
                        changePass: function () {
                            if(this.newpass=="" || this.account=="")
                                alert("请您将信息填写完整");
                            else {
                                this.$http.post("/fixpasswordBack", {
                                        newpass: this.newpass,
                                        account:this.account
                                    },
                                    {emulateJSON: true}).then(function (value) {
                                        alert("修改成功！");
                                    }
                                    , function (reason) {
                                        alert("出错了");
                                    })
                            }
                        }
                    }
                });
            </script>
        </main>
    </div>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
        integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
        crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
        integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
        crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
        integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
        crossorigin="anonymous"></script>


<!-- Icons -->
<script src="https://unpkg.com/feather-icons/dist/feather.min.js"></script>
<script>
    feather.replace()
</script>

<!-- Graphs -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.min.js"></script>

</body>

</html>